import request from '@/utils/request'
import type { ModuleList, Module, ScreenType } from './types'

class APICommon {
    static getModuleList(category_type: string) {
        return request<any, ResponseData<ModuleList[]>>({
            url: '/getModuleList',
            method: 'POST',
            data: { category_type }
        })
    }

    static getModule(data: any, params?: PageQuery) {
        return request<any, ResponseData<Module[]>>({
            url: '/getModule',
            method: 'POST',
            data,
            params
        })
    }

    /** 获取合作伙伴 */
    static getParentList(data: any, params?: PageQuery) {
        return request<any, ResponseData<Module[]>>({
            url: '/getParentList',
            method: 'POST',
            data,
            params
        })
    }

    /** 获取二十四节气 */
    static getPeriodsList() {
        return request<any, ResponseData>({
            url: '/getPeriodsList',
            method: 'POST'
        })
    }

    /** 头部导航栏 */
    static getNextMenuListNew() {
        return request<any, ResponseData>({
            url: '/getNextMenuListNew',
            method: 'POST'
        })
    }

    /** 获取筛选调教类目 */
    static getScreen(type: ScreenType) {
        return request<any, ResponseData>({
            url: '/getScreen',
            method: 'POST',
            data: { type }
        })
    }

    /** 获取活动列表 */
    static getActivityList(data: any, params?: any) {
        return request<any, ResponseData>({
            url: '/getActivityList',
            method: 'POST',
            data,
            params
        })
    }

    /**  */
    static getActivityDeail(id: any) {
        return request<any, ResponseData>({
            url: '/getActivityDeail',
            method: 'POST',
            data: { id }
        })
    }

    static getNotifySums() {
        return request<any, ResponseData>({
            url: '/message/getNotifySums',
            method: 'POST'
        })
    }
    static getNotify() {
        return request<any, ResponseData>({
            url: '/message/getNotify',
            method: 'POST'
        })
    }

    /** 点击详情 -已读 */
    static readNotify(id: any) {
        return request<any, ResponseData>({
            url: '/readNotify',
            method: 'POST',
            data: { id }
        })
    }

    /** 获取店铺信息 */
    static getSquareShopGoods(shop_id: any) {
        return request<any, ResponseData>({
            url: '/getSquareShopGoods',
            method: 'POST',
            data: { shop_id }
        })
    }
    static setActivityForward(id: any) {
        return request<any, ResponseData>({
            url: '/setActivityForward',
            method: 'POST',
            data: { id }
        })
    }

    /** 获取新模块列表 */
    static getNewModuleList(category_type: any) {
        return request<any, ResponseData>({
            url: '/getNewModuleList',
            method: 'POST',
            data: { category_type }
        })
    }

    static getWebIcon() {
        return request<any, ResponseData>({
            url: '/getWebIcon',
            method: 'POST',
        })
    }
}

export default APICommon
